package de.herberlin.webapp.image;

public enum ItemType {

	UNKNOWN,JPG,JPEG,GIF,PNG;
	
	public static ItemType guessFromContent(String contentType) {
		
		if (contentType==null) {
			return UNKNOWN;
		} 
		
		for (ItemType type : ItemType.values()) {
			if (contentType.toUpperCase().indexOf(type.name())>-1) {
				if (type == JPEG ) type=JPG;
				return type;
			}
		}
		return UNKNOWN;
		
	}
}
